package com.czh.oss.adapter;


import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author caozaihui
 * @version 1.0
 * @since 2024/8/17 下午 11:06
 */
@Service
public class FileService {

    @Resource
    private  StorageAdapter storageAdapter;
    /**
     * 上传文件
     * @param multipartFile 文件
     * @param bucketName bucket名称
     * @param objectName 对象名称
     * @return url
     */
    public String uploadObject(MultipartFile multipartFile, String bucketName, String objectName){
        storageAdapter.uploadObject(multipartFile,bucketName,objectName);
        return storageAdapter.getUrl(bucketName,objectName);
    }
}
